import requests

# 指定要请求的 URL
url = 'http://www.people.com.cn/'

# 发送 GET 请求
response = requests.get(url)

# 检查请求是否成功
if response.status_code == 200:
    # 获取网站的内容
    content = response.text

    # 将内容保存到本地文件
    with open('C:/Users/Administrator/Desktop/python练习/Week Three/素材/website_content.html', 'w', encoding='utf-8') as file:
        file.write(content)
    print('网站信息已成功保存到 website_content.html')
else:
    print(f'请求失败，状态码: {response.status_code}')
